home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.basic;
-
- import com.sun.java.swing.AbstractButton;
- import com.sun.java.swing.JToolBar;
- import com.sun.java.swing.border.AbstractBorder;
- import com.sun.java.swing.border.Border;
- import com.sun.java.swing.text.JTextComponent;
- import java.awt.Component;
- import java.awt.Insets;
-
- public class BasicMarginBorder extends AbstractBorder {
- private static Border marginBorder = new BasicMarginBorder();
-
- public Insets getBorderInsets(Component c) {
- if (c instanceof AbstractButton) {
- AbstractButton b = (AbstractButton)c;
- return b.getMargin();
- } else if (c instanceof JToolBar) {
- JToolBar t = (JToolBar)c;
- return t.getMargin();
- } else if (c instanceof JTextComponent) {
- JTextComponent t = (JTextComponent)c;
- return t.getMargin();
- } else {
- return new Insets(0, 0, 0, 0);
- }
- }
-
- public static Border getMarginBorder() {
- return marginBorder;
- }
- }
-